package com.tpe.model.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "GRUPO")
public class Grupo implements Serializable {

	private static final long serialVersionUID = 9196084257505289552L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID_GRUPO", unique = true)
	private Long id;

	@Column(name = "NOME")
	private String nome;
	
	@Column(name = "ATIVO")
	private boolean ativo;

	@ManyToMany
	@JoinTable(name = "INTEGRANTES_GRUPO", 
		joinColumns = @JoinColumn(name = "ID_GRUPO", referencedColumnName = "ID_GRUPO"), 
		inverseJoinColumns = @JoinColumn(name = "ID_USUARIO", referencedColumnName = "ID_USUARIO"))
	private List<Usuario> integrantes;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public boolean isAtivo() {
		return ativo;
	}

	public void setAtivo(boolean ativo) {
		this.ativo = ativo;
	}

	public List<Usuario> getIntegrantes() {
		return integrantes;
	}

	public void setIntegrantes(List<Usuario> integrantes) {
		this.integrantes = integrantes;
	}
}
